package gold.contest;

import gold.utils.InputUtil;

import java.util.Arrays;

/**
 * Created by fanzhenyu02 on 2021/12/10.
 * common problem solver template.
 */
public class LC6112 {
    public long startExecuteTime = System.currentTimeMillis();


    class Solution {
        public int fillCups(int[] amount) {
            int ans = 0;
            Arrays.sort(amount);
            while (amount[2] > 0) {
                amount[2]--;
                amount[1]--;
                ans++;
                Arrays.sort(amount);
            }

            return ans;
        }
    }

    public void run() {
        System.out.println(new Solution().fillCups(InputUtil.toIntegerArray("[5,0,0]")));
        System.out.println(new Solution().fillCups(InputUtil.toIntegerArray("[1,4,2]")));
        System.out.println(new Solution().fillCups(InputUtil.toIntegerArray("[5,4,4]")));
    }

    public static void main(String[] args) throws Exception {
        LC6112 an = new LC6112();
        an.run();

        System.out.println("\ncurrent solution total execute time: " + (System.currentTimeMillis() - an.startExecuteTime) + " ms.");
    }
}
